<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\common\model\xiluhouse\Config;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('请求成功');
    }

    public function config(){
        $data = $this->getData([
            'type' => 'rq'
        ]);
        // $user = $this->auth->getUser();
        $config = Config::where('name',$data['type'])->find();
        $this->success('success',$config);
    }

    public function customerService()
    {
        $list = \app\common\model\xiluhouse\Config::where('group', 'customer')->select();
        $data = [];
        foreach ($list as $item) {
            if ($item['type'] == 'image') {
                $data[$item['name']] = get_oss_url($item['value']);
            }else{
                $data[$item['name']] = $item['value'];
            }
        }
        $this->success('success', $data);
    }
}
